package com.goal.struggle.common.base;

import com.goal.struggle.common.enums.BizCode;
import lombok.Data;

@Data
public class Result<T> {
    private Integer code;
    private String message;
    private T data;

    public static <T> Result<T> ok(){
        Result<T> result = new Result<T>();
        result.setCode(BizCode.SUCCESS.getCode());
        result.setMessage(BizCode.SUCCESS.getMessage());
        return result;
    }

    public static <T> Result<T> ok(T data){
        Result<T> result = new Result<T>();
        result.setCode(BizCode.SUCCESS.getCode());
        result.setData(data);
        result.setMessage(BizCode.SUCCESS.getMessage());
        return result;
    }
}
